/*
 * Copyright (c) 2019. seven studio. @chengdu
 * seven studio in chengdu by lb
 * this project for snmp tool
 */

package com.xlx.openLink.threadtask.workservice;

import com.xlx.openLink.entity.pojo.Alarm;
import com.xlx.openLink.entity.pojo.Device;
import com.xlx.openLink.service.DeviceService;
import com.xlx.openLink.threadtask.workthread.SearchDeviceThread;
import com.xlx.openLink.uitls.Commuitls;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.concurrent.*;

@Component
@Slf4j
public class SearchDeviceService {
    @Autowired
    private DeviceService deviceService;
    @Autowired
    Executor taskExecutor;

    public void SearchDevice(List<Device> deviceList, BlockingDeque<Device> blockingDeque, BlockingDeque<Alarm> alarmBlockingDeque) throws Exception {
        //创建线程池
        ExecutorService executorService = new ThreadPoolExecutor(20, 40, 30L, TimeUnit.SECONDS, new LinkedBlockingQueue());

        //创建线程池
        List<List> listList = Commuitls.spList(deviceList);
        for (List<Device> list : listList) {
            new SearchDeviceThread(blockingDeque, alarmBlockingDeque, list, deviceService).dobiz();
        }



    }


}
